package com.hdf.etdemo.view.section;
import com.hdf.easytools.base.EasyToolsActivity;
import com.hdf.easytools.view.section.SegmentView;
import com.hdf.easytools.view.section.SegmentView.OnIndexChangedListener;
import com.hdf.easytools.view.section.SwitchButton;
import com.hdf.easytools.view.section.SwitchButton.OnToggleChanged;
import com.hdf.easytools.view.section.SwitchView;
import com.hdf.easytools.view.section.SwitchView.OnCheckedChangedListener;
import com.hdf.etdemo.R;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class SectionActivity extends EasyToolsActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_section);
		/**设置标题显示*/
		this.TitleVisib(0, 1, 1, 0, 0);
		/**绑定标题点击事件*/
		this.TitleClick(0, 1, 0, 0, 0);
		/**设置标题样式ʽ*/
		this.TitleStyle(null,R.drawable.et_back, "分段布局及开关", null,0);
		SegmentView segmentView = (SegmentView)this.findViewById(R.id.segmentView);
        segmentView.setOnIndexChangedListener(new OnIndexChangedListener(){
        	@Override
			public void onChanged(SegmentView view, int index) {
				Toast.makeText(SectionActivity.this, "segment"+index, Toast.LENGTH_SHORT).show();
			}
        	
        });
        
        SwitchView switchView = (SwitchView)this.findViewById(R.id.switchView);
        switchView.setOnCheckedChangedListener(new OnCheckedChangedListener(){

			@Override
			public void onChanged(View view, boolean checked) {
				Toast.makeText(SectionActivity.this, "switch"+checked, Toast.LENGTH_SHORT).show();
			}
        	
        });
        
        SwitchButton switchButton = (SwitchButton)this.findViewById(R.id.switchButton);
        switchButton.setOnToggleChanged(new OnToggleChanged(){

			@Override
			public void onToggle(boolean on) {
				Toast.makeText(SectionActivity.this, "switchButton"+on, Toast.LENGTH_SHORT).show();
			}
        	
        });
    }

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.left_img:
				finish();
			break;

		default:
			break;
		}
	}
}


